<form action="<?php e_page("order","index");?>" method="get">
    <fieldset>
        <legend></legend>
        <label for="shopId">商家选择</label>
        <select name="shopId" id="shopId">
            <option value="">所有</option>
            <?php foreach($r['shop_info'] as $v){?>
                <option value="<?php echo $v['id']?>" <?php if($r['shopId']==$v['id']) echo 'selected';?>><?php echo $v['company']?></option>
            <?php }?>
        </select>
        <label for="service_id">服务站选择</label>
        <select name="service_id" id="service_id">
            <option value="">所有</option>
            <?php foreach($r['service_info'] as $v){?>
                <option value="<?php echo $v['id']?>" <?php if($r['service_id']==$v['id']) echo 'selected';?>><?php echo $v['service_name']?></option>
            <?php }?>
        </select>
        <label for="state">订单状态选择</label>
        <select name="state" id="state">
            <option value="">所有</option>
            <?php foreach($r['orderState'] as $k=>$v){?>
                <option value="<?php echo $k;?>"><?php echo $v;?></option>
            <?php }?>
        </select>
        <label for="real_name">用户姓名</label><br/>
        <input type="text" name="real_name" id="real_name" placeholder="请输入用户姓名"><br/>
        <label for="tel">用户手机号</label><br/>
        <input type="text" name="tel" id="tel" placeholder="请输入用户手机号">
        <input type="submit">
    </fieldset>
</form>
<table id="dataTable">
    <thead>
    <tr>
        <th>ID</th>
        <th>订单当前状态</th>
        <!--        <th>客户信息</th>-->
        <th>商家信息</th>
        <th>服务站信息</th>
        <th>用户姓名/联系方式</th>
        <th>代购人姓名/联系方式</th>
        <th>订单金额</th>
        <th>付款金额</th>
        <th>下单时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <?php foreach($r['order_info'] as $v){?>
        <tr>
            <td><?php echo $v['id'];?></td>
            <td><?php
                switch($v['state']){
                    case 'unpaid':echo "未付款";break;
                    case 'unshipped':echo "未发货";break;
                    case 'shipped':echo "已向服务站发货";break;
                    case 'shipped_direct':echo "已向用户发货";break;
                    case 'service':echo "等待服务站配送";break;
                    case 'received':echo "用户已签收";break;
                    case 'confirmed':echo "用户已确认";break;
                    case 'refunding':echo "进入退货流程";break;
                    case 'evaluate':echo "已评价";break;
                    case 'assigned':echo "未知状态";break;
                };
                ?></td>
            <td><?php echo $v['company'];?></td>
            <td><?php echo $v['service_id']?></td>
            <td><?php echo $v['user_id']?>/<?php echo $v['shop_id']?></td>
            <td><?php echo $v['buyer_id']?><?php if(isset($v['express_name'])){?><?php echo "/".$v['express_name']?><?php }?></td>
            <td><?php echo $v['order_amount'];?></td>
            <td><?php echo $v['payment_amount'];?></td>
            <td><?php echo $v['create_time']?></td>
            <td><a href="<?php e_action("detail","id={$v['id']}")?>">查看详情</a></td>
        </tr>
    <?php } ?>
    </tbody>
</table>
<?php
/** @var Page $page */
$page=$r['pages'];
?>
<?php echo $page->getPageHtml(); ?>